#ifndef _LINE_H_
#define _LINE_H_

#define LINEBUF_ALIGN   (4 * 1024)

#define line_t struct line

struct line {
    int   (*open)  (line_t *ln, char *file);
    void  (*close) (line_t *ln);
    int   (*read)  (line_t *ln, char *out[], int n);

    int   fd;
    char *cur;
    int   taillen;
    char *tail;
    int   buflen;  // data bytes in buf
    int   bufsize; // buf size
    char  buf[0];
};


line_t  *line_create();
void     line_destroy(line_t *ln);

// LINE_PRINT()

#endif
